<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/admin/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
        .tdrow{
           font-weight: bold;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <table class="layui-table">
        <tbody>
            <tr>
                <td colspan="6" style="font-weight: bold;font-size: 16px;">
                    订单信息
                    {if $info['urgent_status'] == 1}
                        <span style="color: red;">(加急)</span>
                    {/if}
                </td>
            </tr>
            <tr>
                <td><span class="tdrow">订单编号：</span>{$info.order_on}</td>
                <td><span class="tdrow">订单类型：</span>{$info.type_text}</td>
                <td><span class="tdrow">订单状态：</span>{$info.state_text}</td>
                <td><span class="tdrow">接单商家：</span>{$info.store_name}</td>
            </tr>
            <tr>
                <td><span class="tdrow">起始地址：</span>{$info.start_address}</td>
                <td><span class="tdrow">结束地址：</span>{$info.end_address}</td>
                <td><span class="tdrow">支付时间：</span>{$info.pay_time_text}</td>
                <td><span class="tdrow">代理商：</span>{$info['agent']['name']}</td>
            </tr>
        </tbody>
    </table>
    <table class="layui-table">
        <tbody>
            <tr>
                <td colspan="6" style="font-weight: bold;font-size: 16px;">资金信息</td>
            </tr>
            <tr>
                <td><span class="tdrow">加急金额：</span>{$info.urgent_price}</td>
   
            </tr>
            <tr>
                <td><span class="tdrow">订单总金额：</span>{$info.total_money}</td>
                <td><span class="tdrow">收入金额：</span>{$info.income_money}</td>
                <td><span class="tdrow">订单支付金额：</span>{$info.money}</td>
                <td><span class="tdrow">优惠金额：</span>{$info['total_money'] - $info['money']}</td>
            </tr>
            <tr>
                <td><span class="tdrow">红包优惠金额：</span>{$info.discount_red_money}</td>
                <td><span class="tdrow">满减优惠金额：</span>{$info.discount_decrement_money}</td>
                <td><span class="tdrow">平台红包优惠金额：</span>{$info.discount_platform_red_money}</td>
                <td><span class="tdrow">配送费优惠金额：</span>{$info['discount_delivery_money']}</td>
            </tr>
            <tr>
                <td><span class="tdrow">配送费：</span>{$info.distribution_amount}</td>
                <td><span class="tdrow">配送公里：</span>{$info.distance/1000}公里</td>
                <td><span class="tdrow">配送价格/公里：</span>{$info['weather_km']}公里/{$info['weather_money']}</td>
                <td><span class="tdrow">天气：</span>{$info.weather_text}</td>
            </tr>
        </tbody>
    </table>
    <table class="layui-table">
        <tbody>
            <tr>
                <td colspan="6" style="font-weight: bold;font-size: 16px;">商品信息</td>
            </tr>
            <tr>
                <td class="tdrow">名称</td>
                <td class="tdrow">规格名称</td>
                <td class="tdrow">商品数量</td>
                <td class="tdrow">单价</td>
                <td class="tdrow">打包费</td>
            </tr>
            {foreach $sku as $value}
            <tr>
                <td>{$value.goods_name}</td>
                <td>{$value.goods_specs_name}</td>
                <td>{$value.numbers}</td>
                <td>{$value.price}</td>
                <td>{$value.pack_price}</td>
            </tr>
            {/foreach}
            <tr>
                <td  colspan="3">总价：</td>
                <td>{$info.goods_money}</td>
                <td>{$info.pack_amount}</td>
            </tr>
        </tbody>
    </table>
    <table class="layui-table">
        <tbody>
            <tr>
                <td colspan="6" style="font-weight: bold;font-size: 16px;">补助信息（订单未完成 补助金额不更新）</td>
            </tr>
            <tr>
                <td class="tdrow">类型</td>
                <td class="tdrow">补助百分比</td>
                <td class="tdrow">金额（优惠）</td>
                <td class="tdrow">补助金额</td>
            </tr>
            <tr>
                <td>商家商品补助</td>
                <td>{$info.subsidy_fee_goods}</td>
                <td>{$info.total_money}</td>
                <td>{$info.subsidy_store_goods_money}</td>
            </tr>
            <tr>
                <td>配送费补助</td>
                <td>{$info.subsidy_fee_goods}</td>
                <td>{$info.discount_delivery_money}</td>
                <td>{$info.subsidy_store_delivery_money}</td>
            </tr>
            <tr>
                <td>红包补助</td>
                <td>{$info.subsidy_fee_red}</td>
                <td>{$info.discount_red_money}</td>
                <td>{$info.subsidy_store_red_money}</td>
            </tr>
            <tr>
                <td>平台红包补助</td>
                <td>{$info.subsidy_fee_platform_red}</td>
                <td>{$info.discount_platform_red_money}</td>
                <td>{$info.subsidy_store_platform_red_money}</td>
            </tr>
            <tr>
                <td>满减补助</td>
                <td>{$info.subsidy_fee_decrement}</td>
                <td>{$info.discount_decrement_money}</td>
                <td>{$info.subsidy_store_decrement_money}</td>
            </tr>
        </tbody>
    </table>
    <table class="layui-table">
        <tbody>
            <tr>
                <td colspan="6" style="font-weight: bold;font-size: 16px;">商家状态</td>
            </tr>
            <tr>
                <td><span class="tdrow">接单状态：</span>{$info.state_text}</td>
                <td><span class="tdrow">是否在线：</span>{$info.store_is_state}</td>
                <td><span class="tdrow">出餐状态：</span>{$info.store_state_text}</td>
                <td><span class="tdrow">预计出餐时间：</span>{$info.estimate_meal_time_text}</td>
            </tr>

        </tbody>
    </table>
    <table class="layui-table">
        <tbody>
            <tr>
                <td colspan="6" style="font-weight: bold;font-size: 16px;">用户信息</td>
            </tr>
            <tr>
                <td><span class="tdrow">支付状态：</span>{$info.state_text}</td>
                <td><span class="tdrow">收货人：</span>{$info.username}</td>
                <td><span class="tdrow">手机号：</span>{$info.phone}</td>
                <td><span class="tdrow">收货地址：</span>{$info.end_address}</td>
            </tr>

        </tbody>
    </table>
    <table class="layui-table">
        <tbody>
            <tr>
                <td colspan="6" style="font-weight: bold;font-size: 16px;">骑手信息</td>
            </tr>
            <tr>
                {if $info['rider_id'] > 0}
                <td><span class="tdrow">骑手状态：</span>{$info.rider_status}</td>
                <td><span class="tdrow">用户名：</span>{$info.rider_name}</td>
                <td><span class="tdrow">骑手接单时间：</span>{$info.rider_receiving_time_text}</td>
                <td><span class="tdrow">骑手完成时间：</span>{$info.rider_success_time_text}</td>
                {else}
                <td  style="text-align: center;"><span class="tdrow">没有骑手接单</span></td>
                {/if}
            </tr>

        </tbody>
    </table>

 
</div>
<script src="/static/admin/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/admin/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
      layui.use(['layer', 'form', 'laydate', 'element', 'upload'], function () {

        var $ = layui.$, layer = layui.layer, table = layui.table,  element = layui.element,laydate = layui.laydate, form = layui.form, upload = layui.upload;
        var indexFrame = parent.layer.getFrameIndex(window.name); //获取窗口索引

        $("#saveButton").on('click', function () {
            var loading = layer.open({ type: 3 });
            $.ajax({
                url: "{:url('add')}",
                type: 'post',
                data: $("#DataForm").serialize(),
                success: function (data) {
                    console.log(data);
                    layer.close(loading);
                    if (data.code == 0) {
                        parent.tableReload();
                        parent.layer.close(indexFrame);
                        parent.layer.msg(data.msg);
                    } else {
                        layer.msg(data.msg);
                    }
                }
            })
            return false;
        })

        $("#closeButton").on('click', function () {
            parent.layer.close(indexFrame);
        })

        // 分步表单下一步
        $(".downButton").on('click', function () {
            var id = $(".layui-this").next().attr('lay-id');
            element.tabChange('itemTab', id);
        });
        // 分步表单上一步
        $(".upButton").on('click', function () {
            var id = $(".layui-this").prev().attr('lay-id');
            element.tabChange('itemTab', id);
        });

        upload.render({
                elem: '#upload_logo', url: "{:url('common/images')}", done: function (res) {
                        $("#logo").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_full_id_image', url: "{:url('common/images')}", done: function (res) {
                        $("#full_id_image").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_registration', url: "{:url('common/images')}", done: function (res) {
                        $("#registration").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_storefront_image', url: "{:url('common/images')}", done: function (res) {
                        $("#storefront_image").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_permit_image', url: "{:url('common/images')}", done: function (res) {
                        $("#permit_image").val(res.data.url);
                        layer.msg(res.msg);
                }
        });

        upload.render({
                elem: '#upload_restaurant', url: "{:url('common/images')}", done: function (res) {
                        $("#restaurant").val(res.data.url);
                        layer.msg("成功");
                }
        });

        });
</script>
</body>
</html>